package com.atguigu.userprofile.dao;

import com.atguigu.userprofile.bean.TagInfo;
import com.atguigu.userprofile.utils.MySQLUtil;

import java.util.List;

public class TagInfoDAO {
    public static TagInfo getTagInfo(String taskId){
        String querySQL = "SELECT * FROM tag_info WHERE tag_task_id='"+taskId+"'";
        TagInfo tagInfo = MySQLUtil.queryOne(querySQL, TagInfo.class, true);
        return tagInfo;
    }

    public static List<TagInfo> getTagInfoWithOn(){

        String querySQL = " SELECT tg.id,\n" +
                "          tg.tag_code,\n" +
                "          tg.tag_name,\n" +
                "         tg.tag_level,\n" +
                "          tg.parent_tag_id,\n" +
                "          tg.tag_type,\n" +
                "          tg.tag_value_type,\n" +
                "          tg.tag_value_limit,\n" +
                "          tg.tag_value_step,\n" +
                "          tg.tag_task_id,\n" +
                "          tg.tag_comment,\n" +
                "          tg.update_time,\n" +
                "          tg.create_time\n" +
                "           FROM tag_info tg JOIN task_info tk ON tg.`tag_task_id`=tk.`id` AND task_status = 1";

        return MySQLUtil.queryList(querySQL,TagInfo.class,true);
    }
}
